# 贪吃蛇小游戏，基于pygame
import sys
import pygame
from pygame.locals import QUIT


# 配置常量
FPS = 15
WINDOWWIDTH = 640
WINDOWHEIGHT = 480
CELLSIZE = 20
assert WINDOWWIDTH % CELLSIZE == 0 and WINDOWHEIGHT % CELLSIZE == 0, "画板宽度应该为小格子的整数倍"
CELLWIDTH = int(WINDOWWIDTH / CELLSIZE)     # 一列的格子数
CELLHEIGHT = int(WINDOWHEIGHT / CELLSIZE)

# RGB颜色 （255， 10， 12）
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
DARKGREEN = (0, 155, 0)
DARKGRAY = (40, 40, 40)
BGCOLOR = BLACK

UP = 'up'
DOWN = 'down'
LEFT = 'left'
RIGHT = 'right'

HEAD = 0

# 游戏窗口初始化
pygame.init()
FPSCLOCK = pygame.time.Clock()
DISPLAYSURF = pygame.display.set_mode(size=(WINDOWWIDTH, WINDOWHEIGHT))
BASICFONT = pygame.font.Font('arial.ttf', 18)
pygame.display.set_caption('贪吃蛇')

# 主逻辑
def show_start_screen():
    pass

def run_game():
    """程序主逻辑"""
    pass

def show_end_screen():
    pass

# 事件循环
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
